\documentclass[11pt,a4paper]{article}

% ------------------------------------------- Preamble ----------------------------------------------

\usepackage{lipsum}   % Ipsum lorem generator
\usepackage{authblk}  % Affiliation
\usepackage{xcolor}	  % Text color
\usepackage{hyperref} % Links

% Package to control table placement
\usepackage{float}

% Packages for table formatting
\usepackage{booktabs}
\usepackage{adjustbox}

% Packages to format table notes
\usepackage[flushleft]{threeparttable}


\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}


\title{\texttt{esttab}/\texttt{estout} demo}
\author{Luiza Andrade}
\affil{World Bank, Development Impact Evaluations lcardoso@worldbank.org}


% ---------------------------------------- End of preamble ---------------------------------------------
\begin{document}

\maketitle

\listoftables



\textcolor{red}{Visit \url{https://github.com/bbdaniels/stata-tables} to see the latest version of this material.}


\begin{table}[H]
	\caption{Basic \texttt{esttab} table}
	\begin{adjustbox}{max width = \textwidth}
		\input{Raw/t1_esttab_basic}
	\end{adjustbox}
\end{table}
 
\begin{table}[H]
	\caption{Adding variable labels}
	\begin{adjustbox}{max width = \textwidth}
		\input{Raw/t2_esttab_label}
	\end{adjustbox}
\end{table}

\begin{table}[H]
	\caption{Removing omitted levels}
	\begin{adjustbox}{max width = \textwidth}
		\input{Raw/t3_esttab_omitted}
	\end{adjustbox}
\end{table}


\begin{table}[H]
	\caption{Removing variables from table}
	\begin{adjustbox}{max width = \textwidth}
		\input{Raw/t4_esttab_scalar}
	\end{adjustbox}
\end{table}

\begin{table}[H]
	\caption{Customizing model titles and notes}
	\begin{adjustbox}{max width = \textwidth}
		\input{Raw/t5_esttab_titles}
	\end{adjustbox}
\end{table}

\begin{table}[H]
	\caption{Customizing header}
	\begin{adjustbox}{max width = \textwidth}
		\input{Raw/t6_esttab_header}
	\end{adjustbox}
\end{table}

\section{title}
\begin{table}[H]
	\centering
	\caption{Appending two panels}
	\begin{adjustbox}{max width = \textwidth}
		\begin{threeparttable}
			\input{Raw/t7_esttab_panel}
		\end{threeparttable}
	\end{adjustbox}
\end{table}

% ------------- Appendix ------------------------------------------

\section*{Appendix: fixing table notes}
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
 
\begin{table}[H]
	\centering
	\caption{Table with a wide note}
		\input{Raw/t8_longnote}
\end{table} 
 
\begin{table}[H]
	\centering
	\caption{Adjusting note width with \texttt{threeparttable}}
	\begin{adjustbox}{max width = \textwidth}
		\begin{threeparttable}
			\input{Raw/t9_threeparttable}
		\end{threeparttable}
	\end{adjustbox}
\end{table}


\begin{table}[H]
	\centering
	\caption{Adjusting note width by trial-and-error}
	\input{Raw/t10_unfittednote}
\end{table}  

\begin{table}[H]
	\centering
	\caption{Table with a narrow note}
	\input{Raw/t11_narrownote}
\end{table} 

\begin{table}[H]
	\centering
	\caption{Adjusting narrow note with \texttt{threeparttable}}
	\begin{adjustbox}{max width = \textwidth}
		\begin{threeparttable}
			\input{Raw/t12_narrow3parttable}
		\end{threeparttable}
	\end{adjustbox}
\end{table}

\begin{table}[H]
	\centering
	\caption{Adjusting narrow note by trial-and-error}
		\begin{adjustbox}{max width = \textwidth}
		\begin{threeparttable}
			\input{Raw/t13_manualnarrow}
		\end{threeparttable}
	\end{adjustbox}
\end{table}  
\end{document}

\end{document}



